﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Globalization;

namespace PhoneStore.Presentation.CompositeControl
{
    /// <summary>
    /// Interaction logic for MessageTextbox.xaml
    /// </summary>
    public partial class MessageTextbox : Window
    {
        public MessageTextbox()
        {
            InitializeComponent();
        }

        public bool IsOk { get; set; }
        public int ReturnValue { get; set; }

        public string LabelText
        {
            get
            {
                return lblLabel.Content as string;
            }
            set
            {
                lblLabel.Content = value;
            }
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            int sc;
            if (int.TryParse(txtValue.Text, out sc) && sc > 0)
            {
                IsOk = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("Chỉ nhận giá trị số nguyên dương > 0");
            }
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            IsOk = false;
            this.Close();
        }
    }
}
